package com.npsngs.hawkeye.components;

import com.npsngs.hawkeye.MainActivity;
import com.npsngs.hawkeye.R;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class BinaryzationDialog extends DialogShell implements OnSeekBarChangeListener{
	private SeekBar seekBar = null;
	private View view = null;
	public BinaryzationDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		view = View.inflate(context, R.layout.dialog_binaryzation, null);
		seekBar = (SeekBar) view.findViewById(R.id.threshold_seekBar);
		seekBar.setOnSeekBarChangeListener(this);
		
	}

	@Override
	public Dialog getDialog() {
		// TODO Auto-generated method stub
		dialog = builder
				.setView(view)
				.setMessage(R.string.threshold)
				.setNegativeButton(R.string.cancel, null)
				.setPositiveButton(R.string.sure,null).create();
		return dialog;
	}

	@Override
	public void onProgressChanged(SeekBar seekBar, int progress,
			boolean fromUser) {
		// TODO Auto-generated method stub
		if(!fromUser){
			return;
		}
		MainActivity.nativeBinaryzation(progress);
	}

	@Override
	public void onStartTrackingTouch(SeekBar seekBar) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStopTrackingTouch(SeekBar seekBar) {
		// TODO Auto-generated method stub
		
	}

}
